package com.itheima.Thread.Thread类;

public class Demo {
    public static void main(String[] args) {
        //获取名字从MyThread类中创建构造方法空参和String参数（提供带参）
        MyThread2 t1 = new MyThread2("张三");

        MyThread2 t2 = new MyThread2();
        t2.setName("李四");
        t1.start();
        t2.start();

        //lambda表达式
        //  new Thread(()-> System.out.println("线程开到"+i)).start();
    }
}

class MyThread extends Thread{
    public MyThread() {
    }

    public MyThread(String name) {
        super(name);
    }

    @Override
    public void run() {
        for (int i = 0; i < 50; i++) {
            System.out.println(Thread.currentThread().getName()+"线程开启"+i);
        }
    }
}